#!/usr/bin/python
# -*- coding: UTF-8 -*-
import requests
import os
from spider.requests_helper import Request
from lxml import html
import json


def domestic():
    url = "http://www.dzyong.top:3005/yiqing/province"
    # 获得html内容
    yq_json = Request().get_html_text(url)

    result = json.loads(yq_json)

    list = result['data']
    yq_info_list = []
    for item in list:
        # 疫情信息
        yq_info = {}

        # 省份名称
        yq_info['province_name'] = item['provinceName']
        # 确症人数
        yq_info['confirmed_num'] = item['confirmedNum']
        # 治愈人数
        yq_info['cures_num'] = item['curesNum']
        # 死亡人数
        yq_info['deaths_num'] = item['deathsNum']
        
        yq_info_list.append(yq_info)
    return yq_info_list


if __name__ == '__main__':
    yq_info_list = domestic()
    print(yq_info_list)
